package com.example.demo.producer;

import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * @Author xiao
 * @Date 2025/5/6 上午 8:09
 * @ClassName: StringDemo
 * @Desc:
 */
public class StringDemo {
    public static void main(String[] args) throws UnsupportedEncodingException {
       /* StringBuffer sb = new StringBuffer(" ");
        sb.replace(4,7,"456");
        System.out.println(sb.toString());
        int i = sb.indexOf("4");
        System.out.println(sb.substring(i));
        String[] split = sb.toString().split("\\s+");
        for (String s : split) {
            System.out.println(s);
        }*/
        //DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy年MM月dd日");
        //String day = LocalDateTime.now().format(format);
        //System.out.println(day);

        Scanner sc = new Scanner(System.in);
        // 获取购物车原始总价
        int rawPrice = sc.nextInt();
        // 获取无门槛红包金额
        float gift = sc.nextFloat();
        // 请从这里开始编写代码
        int discount = rawPrice / 400 * 50;
        float giftAmount = (rawPrice - discount - gift);
        System.out.println("双11券后价格 " + giftAmount);

        int[] scores = {79, 52, 98, 81, 10};
        // 1 int[] scores = {10, 52, 98, 81,79 }; 4
        // 2 int[] scores = {10, 52, 98, 81,79 }; 3
        // 3 int[] scores = {10, 52, 79, 81,98 }; 2
        // 4 int[] scores = {10, 52, 79, 81,98 }; 1
    //
        //[10, 52, 98, 81, 79]
    }

    public static int sort(int[] scores) {
        // 数组从小到大排序处理
        for (int i = 0; i < scores.length; i++) {
            int minVal = i;
            for (int j = i + 1; j < scores.length - i; j++) {
                if (scores[minVal] > scores[j]) {
                    minVal = j;
                }
            }
            if (scores[i] != scores[minVal]) {
                // 交换maxvalue的值
                int tem = scores[i];
                scores[i] = scores[minVal];
                scores[minVal] = tem;
            }
        }
        // 打印排序后的数组  可以使用 Arrays.toString()
        System.out.println(Arrays.toString(scores));
        //返回数组中元素的个数
        return scores.length;
    }


}
